////package com.mybatisplus.config;
////
////import io.jsonwebtoken.*;
////import lombok.Data;
////import org.springframework.boot.context.properties.ConfigurationProperties;
////import org.springframework.stereotype.Component;
////import java.util.Date;
////
////@ConfigurationProperties(prefix = "config.jwt", ignoreInvalidFields = true)
////@Component
////@Data
//public class JwtConfig {
//
//    private String secret;
//    private Long expire;
//    private String header;
//
//    public String createToken(String subject) {
//        Date nowDate = new Date();
//        Date expiryDate = new Date(nowDate.getTime() + expire * 1000);
//        return Jwts.builder()
//                .setHeaderParam("typ", "JWT")
//                .setSubject(subject)
//                .setIssuedAt(nowDate)
//                .setExpiration(expiryDate)
//                .signWith(SignatureAlgorithm.HS512, secret)
//                .compact();
//    }
//
//    public Claims getTokenClaim(String token) {
//        try {
//            return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody();
//        } catch (ExpiredJwtException e) {
//            throw new RuntimeException("Token expired", e);
//        } catch (UnsupportedJwtException | MalformedJwtException | SignatureException | IllegalArgumentException e) {
//            throw new RuntimeException("Invalid token", e);
//        }
//    }
//
//    public String getSubject(String token) {
//        return getTokenClaim(token).getSubject();
//    }
//}
